from django.urls import path, include
from django.contrib import admin
from web.views import account, project
from web.views import home
from django.urls import re_path
from web.views import account
from web.views import home
from web.views import project
from web.views import statistics
from web.views import wiki
from web.views import file
from web.views import setting
from web.views import issues
from web.views import dashboard
urlpatterns = [
    re_path(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_star, name='project_star'),
    path('register/', account.register, name='register'),
    path('login/sms/', account.login_sms, name='login_sms'),
    path('login/', account.login, name='login'),
    path('logout/', account.logout, name='logout'),
    path('image/code/', account.image_code, name='image_code'),
    path('send/sms/', account.send_sms, name='send_sms'),
    path('index/', home.index, name='index'),
    # 项目列表
    path('project/list/', project.project_list, name='project_list'),
    re_path(r'project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_star, name='project_star'),
    re_path(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_unstar,
            name='project_unstar'),
    # 项目管理
    path('manage/<int:project_id>/', include([
        path('wiki/', wiki.wiki, name='wiki'),
        path('wiki/add/', wiki.wiki_add, name='wiki_add'),
        path('wiki/catalog/', wiki.wiki_catalog, name='wiki_catalog'),
        path('wiki/delete/<int:wiki_id>/', wiki.wiki_delete, name='wiki_delete'),
        path('wiki/edit/<int:wiki_id>/', wiki.wiki_edit, name='wiki_edit'),
        path('wiki/upload/', wiki.wiki_upload, name='wiki_upload'),


        path('file/', file.file, name='file'),
        path('file/delete/', file.file_delete, name='file_delete'),
       # 后端实现删除文件或文件夹path('file/delete/<int:file_id>/', file.file_delete, name='file_delete'),
        path('cos/credential/', file.cos_credential, name='cos_credential'),
        path('file/post/', file.file_post, name='file_post'),
        path('file/download/<int:file_id>/', file.file_download, name='file_download'),

        path('setting/', setting.setting, name='setting'),
        path('setting/delete/', setting.delete, name='setting_delete'),

        path('issues/', issues.issues, name='issues'),
        path('issues/detail/<int:issues_id>/', issues.issues_detail, name='issues_detail'),
        path('issues/record/<int:issues_id>/', issues.issues_record, name='issues_record'),
        path('issues/change/<int:issues_id>/', issues.issues_change, name='issues_change'),
        path('issues/invite/url/', issues.invite_url, name='invite_url'),

        path('dashboard/', dashboard.dashboard, name='dashboard'),
        path('dashboard/issues/chart/', dashboard.issues_chart, name='issues_chart'),

        path('statistics/', statistics.statistics, name='statistics'),
        path('statistics/priority/', statistics.statistics_priority, name='statistics_priority'),
        path('statistics/project/user/', statistics.statistics_project_user, name='statistics_project_user'),
    ])),
    path('invite/join/<str:code>/', issues.invite_join, name='invite_join'),
    ]
